// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   CVImpl.java

package com.sunwayhorizo.health.hl7.datatypes.common;

import com.sunwayhorizo.health.ets.base.service.ETSService;
import com.sunwayhorizo.health.ets.exceptions.ETSException;
import com.sunwayhorizo.health.hl7.datatypes.ANY;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CD;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.CV;
import com.sunwayhorizo.health.hl7.datatypes.ED;
import com.sunwayhorizo.health.hl7.datatypes.LIST_CR;
import com.sunwayhorizo.health.hl7.datatypes.SET_CD;
import com.sunwayhorizo.health.hl7.datatypes.ST;
import com.sunwayhorizo.health.hl7.datatypes.TYPE;
import com.sunwayhorizo.health.hl7.datatypes.UID;

// Referenced classes of package oracle.apps.ctb.hl7.types.common:
//            CDImpl, ANYImpl, BLImpl, CSImpl, 
//            EDImpl, LIST_CRAdapterImpl, NullFlavorImpl, OIDImpl, 
//            SET_CDImpl, STImpl, TYPEImpl

public class CVImpl extends CDImpl
    implements CV
{

    public static final String RCS_ID = "$Header: CVImpl.java 115.19 2005/09/16 10:39:34 mmoores noship $";
    private static final CV nullNI = new CVImpl(CSImpl.valueOf("NI"));
    private static final CV nullOTH = new CVImpl(CSImpl.valueOf("OTH"));
    private static final CV nullNINF = new CVImpl(CSImpl.valueOf("NINF"));
    private static final CV nullPINF = new CVImpl(CSImpl.valueOf("PINF"));
    private static final CV nullUNK = new CVImpl(CSImpl.valueOf("UNK"));
    private static final CV nullASKU = new CVImpl(CSImpl.valueOf("ASKU"));
    private static final CV nullNAV = new CVImpl(CSImpl.valueOf("NAV"));
    private static final CV nullMSK = new CVImpl(CSImpl.valueOf("MSK"));
    private static final CV nullNA = new CVImpl(CSImpl.valueOf("NA"));
    private static final CV nullNASK = new CVImpl(CSImpl.valueOf("NASK"));

    /**
     * 修改构造方法，增加ST st4, ST st5
     * 修改人：jinzw
     * 修改时间：2010-11-15
     */
    protected CVImpl(ST st, UID uid, ST st1, ST st2, ST st3,ST st4, ST st5, ED ed)
    {
        super(st, uid, st1, st2, st3,st4,st5, ed, LIST_CRAdapterImpl.nullLIST_CR(NullFlavorImpl.NI), SET_CDImpl.nullSET_CD(NullFlavorImpl.NI));
    }

    /**
     * 修改构造方法，增加ST st4, ST st5
     * 修改人：jinzw
     * 修改时间：2010-11-15
     */
    protected CVImpl(ETSService etsservice, ST st, UID uid, ST st1, ST st2, ST st3,ST st4, ST st5, ED ed)
        throws ETSException
    {
        super(etsservice, st, uid, st1, st2, st3,st4,st5, ed, LIST_CRAdapterImpl.nullLIST_CR(NullFlavorImpl.NI), SET_CDImpl.nullSET_CD(NullFlavorImpl.NI));
    }

    protected CVImpl(CS cs)
    {
        super(cs);
    }

    public LIST_CR qualifier()
    {
        return LIST_CRAdapterImpl.nullLIST_CR(NullFlavorImpl.NA);
    }

    public SET_CD translation()
    {
        return SET_CDImpl.nullSET_CD(NullFlavorImpl.NA);
    }

    public TYPE dataType()
    {
        return com.sunwayhorizo.health.hl7.datatypes.common.TYPEImpl.CV;
    }

    public int hashCode()
    {
        int i = 17;
        if(isNull().isFalse())
        {
            i = 37 * i + code().hashCode();
            i = 37 * i + codeSystem().hashCode();
            i = 37 * i + (qualifier() != null ? qualifier().hashCode() : 0);
        }
        return i;
    }

    public BL equal(ANY any)
    {
        if(any instanceof CV)
        {
            if(any.isNull().isTrue())
            {
                return BLImpl.FALSE;
            } else
            {
                CV cv = (CV)any;
                return code().equal(cv.code()).and(codeSystem().equal(cv.codeSystem()));
            }
        } else
        {
            return BLImpl.FALSE;
        }
    }

    /**
     * 修改方法，增加参数String s5,String s6
     *
     * jinzw
     * 2010-11-15
     */
    public static CV valueOf(String s, String s1, String s2, String s3, String s4,String s5,String s6, ED ed)
    {
        ST st = STImpl.valueOf(s);
        com.sunwayhorizo.health.hl7.datatypes.OID oid = OIDImpl.valueOf(s1);
        ST st1 = STImpl.valueOf(s2);
        ST st2 = STImpl.valueOf(s3);
        ST st3 = STImpl.valueOf(s4);
        ST st4 = STImpl.valueOf(s5);
        ST st5 = STImpl.valueOf(s6);
        return new CVImpl(st, oid, st1, st2, st3,st4,st5, ed);
    }

    /**
     * 修改方法错误
     *
     * jinzw
     * 2010-11-15
     * @param s
     * @param s1
     * @return
     */
    public static CD valueOf(String s, String s1)
    {
        ST st = STImpl.valueOf(s);
        com.sunwayhorizo.health.hl7.datatypes.OID oid = OIDImpl.valueOf(s1);
        ST st1 = STImpl.nullST(NullFlavorImpl.NI);
        return new CVImpl(st, oid, st1, st1, st1,st1,st1, EDImpl.nullED(NullFlavorImpl.NI));
    }

    /**
     * 修改方法，增加参数ST st4,ST st5
     *
     * jinzw
     * 2010-11-15
     */
    public static CV valueOf(ST st, UID uid, ST st1, ST st2, ST st3,ST st4,ST st5, ED ed)
    {
        return new CVImpl(st, uid, st1, st2, st3,st4,st5, ed);
    }

    /**
     * 修改方法，增加参数ST st4, ST st5,ED
     *
     * jinzw
     * 2010-11-15
     */
    public static CV valueOf(ETSService etsservice, ST st, UID uid, ST st1, ST st2, ST st3, ST st4, ST st5,ED ed)
        throws ETSException
    {
        return new CVImpl(etsservice, st, uid, st1, st2, st3,st4,st5, ed);
    }

    public static CV nullCV(CS cs)
    {
        String s = null;
        if(cs == null || cs.literal().stringValue() == null || cs.isNull().isTrue())
            s = "NI";
        else
            s = cs.literal().stringValue();
        if(s.equals("NI"))
            return nullNI;
        if(s.equals("OTH"))
            return nullOTH;
        if(s.equals("NINF"))
            return nullNINF;
        if(s.equals("PINF"))
            return nullPINF;
        if(s.equals("UNK"))
            return nullUNK;
        if(s.equals("ASKU"))
            return nullASKU;
        if(s.equals("NAV"))
            return nullNAV;
        if(s.equals("MSK"))
            return nullMSK;
        if(s.equals("NA"))
            return nullNA;
        if(s.equals("NASK"))
            return nullNASK;
        else
            return nullNI;
    }

}
